package com.jhhc.RHDB.RiverForecast.Calculate.util;

import java.math.BigDecimal;

public class CalculateUtil {


    /**
     * 一次矫正计算方法
     */
    public double correction(double x,int month){
        BigDecimal bigDecimal = null;
        double s = 0.0;
        switch (month){
            case 1:
                bigDecimal = new BigDecimal("6E-09");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0057 * x - 1.5344;
            case 2:
                bigDecimal = new BigDecimal("8E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.005 * x - 0.6750;
            case 3:
                bigDecimal = new BigDecimal("5E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0048 * x - 0.5184;
            case 4:
                bigDecimal = new BigDecimal("4E-09");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0062 * x + 0.5246;
            case 5:
                bigDecimal = new BigDecimal("-2E-09");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0057 * x + 0.4028;
            case 6:
                bigDecimal = new BigDecimal("9E-11");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0053 * x - 0.5390;
            case 7:
                bigDecimal = new BigDecimal("3E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0038 * x - 3.0128;
            case 8:
                bigDecimal = new BigDecimal("-3E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0048 * x + 2.6462;
            case 9:
                bigDecimal = new BigDecimal("6E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0065 * x - 4.6949;
            case 10:
                bigDecimal = new BigDecimal("9E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0063 * x - 3.7601;
            case 11:
                bigDecimal = new BigDecimal("-1E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.006 * x + 0.8666;
            case 12:
                bigDecimal = new BigDecimal("-8E-08");
                s = Double.parseDouble(bigDecimal.toPlainString());
                return Math.pow(x,2) * s + 0.0066 * x + 2.2884;
            default:
                return 0;
        }

    }


}
